package com.example.administrator.zkdemo.db.orm.manager;

/**
 * @author 丁可
 * @package com.example.administrator.zkdemo.db.orm.manager
 * @fileName DataManager
 * @date 2018/11/19 0019 10:28
 * @description
 * @org http://www.gshbzw.com/ 人和致远数据服务有限责任公司
 */

import android.database.Cursor;

import com.example.administrator.zkdemo.core.interfaces.DatabaseInterface;
import com.example.administrator.zkdemo.db.orm.AbstractORM;
import com.zkteco.util.YAMLHelper;

import java.util.List;


public class DataManager extends AbstractDataManager {
    public Number executeInsert(String paramString, DatabaseInterface.SQLCommand paramSQLCommand) {
        return this.provider.executeInsert(paramString, paramSQLCommand);
    }

    public Cursor executeQuery(String paramString, DatabaseInterface.SQLCommand paramSQLCommand) {
        return this.provider.executeQuery(paramString, paramSQLCommand);
    }

    public void executeSql(String paramString1, String paramString2, Object[] paramArrayOfObject) {
        this.provider.executeSql(paramString1, paramString2, paramArrayOfObject);
    }

    public boolean executeTransaction(String paramString, List<DatabaseInterface.SQLCommand> paramList) {
        return this.provider.executeTransaction(paramString, paramList);
    }

    public void executeUpdate(String paramString, DatabaseInterface.SQLCommand paramSQLCommand) {
        this.provider.executeUpdate(paramString, paramSQLCommand);
    }

    public String getDatabaseId() {
        return "ZKDB.db";
    }

    public int getDatabaseVersion() {
        return 1;
    }

    public int getIntOption(String paramString, int paramInt) {
        return this.provider.getIntOption(paramString, paramInt);
    }

    public String getStrOption(String paramString1, String paramString2) {
        return this.provider.getStrOption(paramString1, paramString2);
    }

    public List<AbstractORM> getTables() {
        try {
            List localList = (List) YAMLHelper.getInstanceFromFile("mnt/sdcard/config/orm/zkdb_createtable.yml");
            return localList;
        } catch (Exception localException) {
            localException.printStackTrace();
        }
        return null;
    }

    protected void onTableModified(String paramString) {
    }

    public void open(String paramString, Integer paramInteger) {
        this.provider.open(paramString, paramInteger);
    }

    public Cursor queryBySql(String paramString) {
        if (paramString == null)
            return null;
        DatabaseInterface.SQLCommand localSQLCommand = new DatabaseInterface.SQLCommand();
        localSQLCommand.setSql(paramString);
        return this.provider.executeQuery(getDatabaseId(), localSQLCommand);
    }

    public int setIntOption(String paramString, int paramInt) {
        return this.provider.setIntOption(paramString, paramInt);
    }

    public int setStrOption(String paramString1, String paramString2) {
        return this.provider.setStrOption(paramString1, paramString2);
    }

    public int systemFree() {
        return this.provider.systemFree();
    }

    public void systemInit() {
        this.provider.systemInit();
    }

    public void systemInitOptionTable() {
        this.provider.systemInitOptionTable();
    }
}
